import {
  createStore
} from "vuex";
const store = createStore({
  state: {
    cellback_detail_like: {
      _state: false,
      _id: ''
    },
    cellback_del_comment: {
      _id: '',
      _state: true,
      num:0
    },
    two_level_comment: {
      _id: '',
      _state: true
    }
  },
  mutations: {
    up_cellback_detail_like(state, data) {
      state.cellback_detail_like._state = data.isLike
      state.cellback_detail_like._id = data._id
    },
    reset_cellback_detail_like(state) {
      state.cellback_detail_like._state = false
    },
    up_cellback_detail_comment(state, data) {
      state.cellback_del_comment._id = data.article_id
      state.cellback_del_comment._state = data.comment_state
      state.cellback_del_comment.num = data.updated
    },
    reset_cellback_detail_comment(state) {
      state.cellback_del_comment._id = ""
    },
    reset_two_level_comment(state) {
      state.two_level_comment._id = "xiaozhou"
    },
    add_two_level_comment(state, data) {
      state.two_level_comment._state = true
      state.two_level_comment._id = data
    },
    reduce_two_level_comment(state, data) {
      state.two_level_comment._state = false
      state.two_level_comment._id = data
    }
  },
  getters: {
    watch_cellback_detail_like(state) {
      return state.cellback_detail_like
    },
    watch_cellback_del_comment(state) {
      return state.cellback_del_comment
    },
    watch_two_level_comment(state) {
      return state.two_level_comment
    }
  }
});
export default store
